home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Procedure Call Logger / Sample.r < prev   
Text File  |  1991-04-17  |  6KB  |  285 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © Apple Computer, Inc. 1989-1990
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89    MPW 3.1
  18. #                1.03                02/90    MPW 3.2
  19. #
  20. #    Components:
  21. #                Sample.c            Feb.  1, 1990
  22. #                Sample.r            Feb.  1, 1990
  23. #                Sample.h            Feb.  1, 1990
  24. #                Sample.make            Feb.  1, 1990
  25. #
  26. #    Sample is an example application that demonstrates how to
  27. #    initialize the commonly used toolbox managers, operate 
  28. #    successfully under MultiFinder, handle desk accessories, 
  29. #    and create, grow, and zoom windows.
  30. #
  31. #    It does not by any means demonstrate all the techniques 
  32. #    you need for a large application. In particular, Sample 
  33. #    does not cover exception handling, multiple windows/documents, 
  34. #    sophisticated memory management, printing, or undo. All of 
  35. #    these are vital parts of a normal full-sized application.
  36. #
  37. #    This application is an example of the form of a Macintosh 
  38. #    application; it is NOT a template. It is NOT intended to be 
  39. #    used as a foundation for the next world-class, best-selling, 
  40. #    600K application. A stick figure drawing of the human body may 
  41. #    be a good example of the form for a painting, but that does not 
  42. #    mean it should be used as the basis for the next Mona Lisa.
  43. #
  44. #    We recommend that you review this program or TESample before 
  45. #    beginning a new application.
  46. ------------------------------------------------------------------------------*/
  47.  
  48.  
  49. #include "SysTypes.r"
  50. #include "Types.r"
  51.  
  52. #include "Sample.h"
  53.  
  54. resource 'vers' (1) {
  55.     0x02, 0x00, release, 0x00,
  56.     verUS,
  57.     "1.03",
  58.     "1.03, Copyright \251 Apple Computer, Inc. 1989-1990"
  59. };
  60.  
  61.  
  62. /* this is a definition for a resource which contains only a rectangle */
  63.  
  64. type 'RECT' {
  65.     rect;
  66. };
  67.  
  68.  
  69. /* we use an MBAR resource to conveniently load all the menus */
  70.  
  71. resource 'MBAR' (rMenuBar, preload) {
  72.     { mApple, mFile, mEdit, mLight };    /* four menus */
  73. };
  74.  
  75.  
  76. resource 'MENU' (mApple, preload) {
  77.     mApple, textMenuProc,
  78.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  79.     enabled, apple,
  80.     {
  81.         "About Sample…",
  82.             noicon, nokey, nomark, plain;
  83.         "-",
  84.             noicon, nokey, nomark, plain
  85.     }
  86. };
  87.  
  88. resource 'MENU' (mFile, preload) {
  89.     mFile, textMenuProc,
  90.     MenuItem12,                /* enable Quit only, program enables others */
  91.     enabled, "File",
  92.     {
  93.         "New",
  94.             noicon, "N", nomark, plain;
  95.         "Open",
  96.             noicon, "O", nomark, plain;
  97.         "-",
  98.             noicon, nokey, nomark, plain;
  99.         "Close",
  100.             noicon, "W", nomark, plain;
  101.         "Save",
  102.             noicon, "S", nomark, plain;
  103.         "Save As…",
  104.             noicon, nokey, nomark, plain;
  105.         "Revert",
  106.             noicon, nokey, nomark, plain;
  107.         "-",
  108.             noicon, nokey, nomark, plain;
  109.         "Page Setup…",
  110.             noicon, nokey, nomark, plain;
  111.         "Print…",
  112.             noicon, nokey, nomark, plain;
  113.         "-",
  114.             noicon, nokey, nomark, plain;
  115.         "Quit",
  116.             noicon, "Q", nomark, plain
  117.     }
  118. };
  119.  
  120. resource 'MENU' (mEdit, preload) {
  121.     mEdit, textMenuProc,
  122.     NoItems,                /* disable everything, program does the enabling */
  123.     enabled, "Edit",
  124.      {
  125.         "Undo",
  126.             noicon, "Z", nomark, plain;
  127.         "-",
  128.             noicon, nokey, nomark, plain;
  129.         "Cut",
  130.             noicon, "X", nomark, plain;
  131.         "Copy",
  132.             noicon, "C", nomark, plain;
  133.         "Paste",
  134.             noicon, "V", nomark, plain;
  135.         "Clear",
  136.             noicon, nokey, nomark, plain
  137.     }
  138. };
  139.  
  140. resource 'MENU' (mLight, preload) {
  141.     mLight, textMenuProc,
  142.     NoItems,                /* disable everything, program does the enabling */
  143.     enabled, "Traffic",
  144.      {
  145.         "Red Light",
  146.             noicon, nokey, nomark, plain;
  147.         "Green Light",
  148.             noicon, nokey, nomark, plain
  149.     }
  150. };
  151.  
  152.  
  153. /* this ALRT and DITL are used as an About screen */
  154.  
  155. resource 'ALRT' (rAboutAlert, purgeable) {
  156.     {40, 20, 160, 297},
  157.     rAboutAlert,
  158.     { /* array: 4 elements */
  159.         /* [1] */
  160.         OK, visible, silent,
  161.         /* [2] */
  162.         OK, visible, silent,
  163.         /* [3] */
  164.         OK, visible, silent,
  165.         /* [4] */
  166.         OK, visible, silent
  167.     }
  168. };
  169.  
  170. resource 'DITL' (rAboutAlert, purgeable) {
  171.     { /* array DITLarray: 5 elements */
  172.         /* [1] */
  173.         {88, 185, 108, 265},
  174.         Button {
  175.             enabled,
  176.             "OK"
  177.         },
  178.         /* [2] */
  179.         {8, 8, 24, 214},
  180.         StaticText {
  181.             disabled,
  182.             "Simple Sample (Traffic Light)"
  183.         },
  184.         /* [3] */
  185.         {32, 8, 48, 296},
  186.         StaticText {
  187.             disabled,
  188.             "Copyright © Apple Computer 1989-1990"
  189.         },
  190.         /* [4] */
  191.         {56, 8, 72, 136},
  192.         StaticText {
  193.             disabled,
  194.             "Brought to you by:"
  195.         },
  196.         /* [5] */
  197.         {80, 24, 112, 167},
  198.         StaticText {
  199.             disabled,
  200.             "Macintosh Developer  Technical Support"
  201.         }
  202.     }
  203. };
  204.  
  205.  
  206. /* this ALRT and DITL are used as an error screen */
  207.  
  208. resource 'ALRT' (rUserAlert, purgeable) {
  209.     {40, 20, 120, 260},
  210.     rUserAlert,
  211.     { /* array: 4 elements */
  212.         /* [1] */
  213.         OK, visible, silent,
  214.         /* [2] */
  215.         OK, visible, silent,
  216.         /* [3] */
  217.         OK, visible, silent,
  218.         /* [4] */
  219.         OK, visible, silent
  220.     }
  221. };
  222.  
  223.  
  224. resource 'DITL' (rUserAlert, purgeable) {
  225.     { /* array DITLarray: 3 elements */
  226.         /* [1] */
  227.         {50, 150, 70, 230},
  228.         Button {
  229.             enabled,
  230.             "OK"
  231.         },
  232.         /* [2] */
  233.         {10, 60, 30, 230},
  234.         StaticText {
  235.             disabled,
  236.             "Sample - Error occurred!"
  237.         },
  238.         /* [3] */
  239.         {8, 8, 40, 40},
  240.         Icon {
  241.             disabled,
  242.             2
  243.         }
  244.     }
  245. };
  246.  
  247.  
  248. resource 'WIND' (rWindow, preload, purgeable) {
  249.     {60, 40, 290, 160},
  250.     noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
  251. };
  252.  
  253. resource 'RECT' (rStopRect, preload, purgeable) {
  254.     {10, 10, 110, 110}
  255. };
  256.  
  257. resource 'RECT' (rGoRect, preload, purgeable) {
  258.     {120, 10, 220, 110}
  259. };
  260.  
  261.  
  262. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  263.  
  264. resource 'SIZE' (-1) {
  265.     dontSaveScreen,
  266.     acceptSuspendResumeEvents,
  267.     enableOptionSwitch,
  268.     canBackground,                /* we can background; we don't currently, but our sleep value */
  269.                                 /* guarantees we don't hog the Mac while we are in the background */
  270.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  271.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  272.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  273.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  274.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  275.     reserved,
  276.     reserved,
  277.     reserved,
  278.     reserved,
  279.     reserved,
  280.     reserved,
  281.     reserved,
  282.     kPrefSize * 1024,
  283.     kMinSize * 1024    
  284. };
  285.